import { createSlice } from '@reduxjs/toolkit'

// 创建store子模块
export const goodsSlice = createSlice({
  name: 'goods',
//   初始值
  initialState: {
    title:'香蕉',
    price:40,
    count:24
  },
  reducers: {
   changeInfo(state,action) {
    state.title = action.payload.title
    state.price = action.payload.price
    state.count = action.payload.count
    // state = action.payload
   }
  }
})


export const { changeInfo } = goodsSlice.actions


export default goodsSlice.reducer